import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //求一个整数，在内存当中存储时，二进制1的个数。
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count = 0;
        while(n != 0) {
            count++;
            n &= (n-1);
        }
        System.out.println(count);
    }
    public static void main6(String[] args) {
        //求2个整数的最大公约数
        Scanner scn = new Scanner(System.in);
        int a = scn.nextInt();
        int b = scn.nextInt();
        int c = a % b;
        while(c != 0) {
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }
    public static void main5(String[] args) {
        //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
        int flag = 1;
        double sum = 0;
        for (int i = 1; i <= 100; i++) {
            sum += 1.0 / i * flag;
            flag = -flag;
        }
        System.out.println(sum);
    }

    public static void main4(String[] args) {
        //水仙花数
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for(int i = 0; i <= n; i++) {
            int tmp = i;
            int sum = 0;
            int count = 0;
            while(tmp != 0) {
                count++;
                tmp /= 10;
            }
            tmp = i;
            while(tmp != 0) {
                sum +=Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if(sum == i) {
                System.out.print(i +" ");
            }
        }
    }
    public static void main3(String[] args) {
        //打印 X 图形
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n=in.nextInt();
            for(int i = 0; i<n; i++) {
                for(int j = 0; j<n; j++) {
                    if(i == j || i + j == n - 1) {
                        System.out.print("*");
                    }
                    else {
                        System.out.print(" ");
                    }
                }
                System.out.println("");
            }
        }
    }

    public static void main2(String[] args) {
        //判断素数
        Scanner scanner=new Scanner(System.in);
        int n= scanner.nextInt();
        int flag = 1;
        for(int i = 2; i < n; i++) {
            flag = 1;
            if(n % i == 0) {
                flag = 0;
                break;
            }
        }
        if(flag == 1) {
            System.out.println(n + "是素数");
        }
        else {
            System.out.println(n + "不是素数");
        }
    }
    public static void main1(String[] args) {
        //数九
        int cout = 0;
        for (int i = 1; i <= 100; i++) {
           if(i % 10 == 9) {
               cout++;
           }
           if(i / 10 == 9) {
               cout++;
           }
        }
        System.out.println(cout);
        }
}